<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="/bigjo/js/jquery.js"></script>
<script type="text/javascript" src="/bigjo/js/jquery-1.3.2.min.js"></script>
<title>가수 등록창</title>

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
	jQuery.noConflict();
	jQuery("#singerCheck").click(function() {
			var idx = document.URL.indexOf("bigjo");
			var str = document.URL.substring(0, idx + 5);
			
			var singer = jQuery("#singer").val();
			if(singer==null || singer==""){
				alert("가수를 입력하세요");
				return;
			}
			jQuery.ajax({
				url : str + "/searchSingerNo.ha?singer=" + singer,
			success : function(data) {
				jQuery("#singerList").html(data);
			},
			error : function(request, status, error) {
				alert("가수를 먼저 등록하세요");
				document.rocation.href=str+"/regSinger.ha";
			}
		});
	});
	jQuery.noConflict();
	jQuery("#Insertsub").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		var s_singer = jQuery("#singer").val();
		var s_gender = jQuery("#s_gender").val();
		var s_members = jQuery("#s_members").val();
		alert(s_singer+s_gender+s_members)
		jQuery.ajax({
			url : str+"/singerCheck.ha?s_singer="+s_singer,
			success : function(data) {
				alert("이미 등록된 가수 입니다.");
			},
			error: function(request,status,error){
				location.href=str+"/insertSinger.ha?s_singer="+s_singer+"&s_gender="+s_gender+"&s_members="+s_members;				
			}
		});
	});
});

</script>
</head>
<body>
	<jsp:include page="/upMenu.main"></jsp:include>

	<div>
		<form action="/bigjo/insertMusic.ha" enctype="multipart/form-data" method="post">
			<table align="center">
				<tr>
					<td align="right">가수 이름</td>
					<td align="left"><input type="text" id="singer" name="singer" value=""><input type="button" id="singerCheck" value="가수 검색"></td>
				</tr>
				<tr>
					<td colspan="2"><div id="singerList"></div></td>
				</tr>
				<tr>
					<td align="right">제목 </td>
					<td align="left"><input type="text" id="title" name="title" value=""><input type="button" id="titleCheck" value="제목 검색"></td>
				</tr>
				<tr>
					<td align="right">발매일</td>
					<td align="left">
						<input type="text" maxlength="4" size="4" id="year" name="year" value="">년
						<input type="text" maxlength="2" size="2" id="month" name="month" value="">월
						<input type="text" maxlength="2" size="2" id="day" name="day" value="">일
					</td>
				</tr>
				<tr>
					<td align="right">피처링</td>
					<td align="left">
						<input type="text" id="feat" name="feat" value="">
					</td>
				</tr>
				<tr>
					<td align="right">장르</td>
					<td align="left">
						<select id="genre" name="genre">
							<option>발라드</option>
							<option>알앤비</option>
							<option>어반</option>
							<option>댄스</option>
							<option>힙합</option>
							<option>랩</option>
							<option>락</option>
							<option>애니메이션</option>
							<option>드라마음악</option>
							<option>영화음악</option>
						</select>
					</td>
				</tr>
				<tr>
					<td align="right">앨범 명</td>
					<td align="left">
						<input type="text" id="album" name="album" value="">
					</td>
				</tr>
				<tr>
					<td align="right">앨범아트</td>
					<td align="left">
						<input type="file" id="albumArt" name="albumArt" value="">
					</td>
				</tr>
				<!-- <tr>
					<td align="right">음원</td>
					<td align="left">
						<input type="file" id="audio" name="audio" value="">
					</td>
				</tr>
				<tr>
					<td align="right">티저</td>
					<td align="left">
						<input type="file" id="video" name="video" value="">
					</td>
				</tr> -->
				<tr>
					<td></td>
					<td >
						<input type="submit" value="등록"> 
						<input type="button" id="mInsertcancel" name="Insertcancel" value="취소">
					</td>
				</tr>
			</table>
		</form>
	</div>

</body>
</html>